# RUN: llc -march=amdgcn -mcpu=gfx90a %s -run-pass twoaddressinstruction -verify-machineinstrs -o - | FileCheck -check-prefix=GCN %s

# GCN-LABEL: name: test_fmamk_reg_imm_f64
# GCN: V_FMA_F64_e64 0, killed %0, 0, %2, 0, killed %1, 0, 0, implicit $mode, implicit $exec
---
name:            test_fmamk_reg_imm_f64
registers:
  - { id: 0, class: vreg_64_align2 }
  - { id: 1, class: vreg_64_align2 }
  - { id: 2, class: vreg_64_align2 }
  - { id: 3, class: vreg_64_align2 }
body:             |
  bb.0:

    %0 = IMPLICIT_DEF
    %1 = COPY %0
    %2 = V_MOV_B64_PSEUDO 4607182418800017408, implicit $exec
    %3 = V_FMAC_F64_e32 killed %0, %2, killed %1, implicit $mode, implicit $exec

...

# GCN-LABEL: name: test_fmamk_imm_reg_f64
# GCN: V_FMA_F64_e64 0, %2, 0, killed %0.sub0_sub1, 0, killed %1, 0, 0, implicit $mode, implicit $exec
---
name:            test_fmamk_imm_reg_f64
registers:
  - { id: 0, class: vreg_128_align2 }
  - { id: 1, class: vreg_64_align2 }
  - { id: 2, class: vreg_64_align2 }
  - { id: 3, class: vreg_64_align2 }
body:             |
  bb.0:

    %0 = IMPLICIT_DEF
    %1 = COPY %0.sub2_sub3
    %2 = V_MOV_B64_PSEUDO 4607182418800017408, implicit $exec
    %3 = V_FMAC_F64_e32 %2, killed %0.sub0_sub1, killed %1, implicit $mode, implicit $exec

...

# GCN-LABEL: name: test_fmaak_f64
# GCN: V_FMA_F64_e64 0, killed %0.sub0_sub1, 0, %0.sub2_sub3, 0, %1, 0, 0, implicit $mode, implicit $exec
---
name:            test_fmaak_f64
registers:
  - { id: 0, class: vreg_128_align2 }
  - { id: 1, class: vreg_64_align2 }
  - { id: 2, class: vreg_64_align2 }
body:             |
  bb.0:

    %0 = IMPLICIT_DEF
    %1 = V_MOV_B64_PSEUDO 4607182418800017408, implicit $exec
    %2 = V_FMAC_F64_e32 killed %0.sub0_sub1, %0.sub2_sub3, %1, implicit $mode, implicit $exec

...

# GCN-LABEL: name: test_fmaak_sgpr_src0_f64
# GCN: V_FMA_F64_e64 0, killed %0, 0, %1, 0, %2:vreg_64_align2, 0, 0, implicit $mode, implicit $exec

---
name:            test_fmaak_sgpr_src0_f64
registers:
  - { id: 0, class: sreg_64 }
  - { id: 1, class: vreg_64_align2 }
  - { id: 2, class: vreg_64_align2 }
  - { id: 3, class: vreg_64_align2 }
body:             |
  bb.0:

    %0 = IMPLICIT_DEF
    %1 = V_MOV_B64_PSEUDO 4607182418800017408, implicit $exec
    %3 = V_FMAC_F64_e32 killed %0, %1, %2, implicit $mode, implicit $exec

...

# GCN-LABEL: name: test_fmaak_inlineimm_src0_f64
# GCN: V_FMA_F64_e64 0, 4611686018427387904, 0, %0, 0, %1:vreg_64_align2, 0, 0, implicit $mode, implicit $exec

---
name:            test_fmaak_inlineimm_src0_f64
registers:
  - { id: 0, class: vreg_64_align2 }
  - { id: 1, class: vreg_64_align2 }
  - { id: 2, class: vreg_64_align2 }
body:             |
  bb.0:

    %0 = V_MOV_B64_PSEUDO 4607182418800017408, implicit $exec
    %2 = V_FMAC_F64_e32 4611686018427387904, %0, %1, implicit $mode, implicit $exec

...

# GCN-LABEL: name: test_fmaak_otherimm_src0_f64
# GCN: V_FMAC_F64_e32 4636737291354636288, %0, %2, implicit $mode, implicit $exec

---
name:            test_fmaak_otherimm_src0_f64
registers:
  - { id: 0, class: vreg_64_align2 }
  - { id: 1, class: vreg_64_align2 }
  - { id: 2, class: vreg_64_align2 }
body:             |
  bb.0:

    %0 = V_MOV_B64_PSEUDO 4607182418800017408, implicit $exec
    %2 = V_FMAC_F64_e32 4636737291354636288, %0, %1, implicit $mode, implicit $exec

...

# GCN-LABEL: name: test_fmaak_other_constantlike_src0_f64
# GCN: V_FMAC_F64_e32 %stack.0, %0, %2, implicit $mode, implicit $exec
---
name:            test_fmaak_other_constantlike_src0_f64
registers:
  - { id: 0, class: vreg_64_align2 }
  - { id: 1, class: vreg_64_align2 }
  - { id: 2, class: vreg_64_align2 }
stack:
  - { id: 0, name: "", type: default, offset: 0, size: 128, alignment: 8,
      callee-saved-register: '', local-offset: 0, debug-info-variable: '',
      debug-info-expression: '', debug-info-location: '' }
body:             |
  bb.0:

    %0 = V_MOV_B64_PSEUDO 4607182418800017408, implicit $exec
    %2 = V_FMAC_F64_e32 %stack.0, %0, %1, implicit $mode, implicit $exec

...

# GCN-LABEL: name: test_fmamk_reg_unfoldable_literal_src0_f64
# GCN: V_FMA_F64_e64 0, %2, 0, killed %0, 0, killed %1, 0, 0, implicit $mode, implicit $exec
---
name:            test_fmamk_reg_unfoldable_literal_src0_f64
registers:
  - { id: 0, class: vreg_64_align2 }
  - { id: 1, class: vreg_64_align2 }
  - { id: 2, class: vreg_64_align2 }
  - { id: 3, class: vreg_64_align2 }
body:             |
  bb.0:

    %0 = IMPLICIT_DEF
    %1 = COPY %0
    %2 = V_MOV_B64_PSEUDO 123456, implicit $exec
    %3 = V_FMAC_F64_e32 %2, killed %0, killed %1, implicit $mode, implicit $exec

...

# GCN-LABEL: name: test_fmamk_reg_unfoldable_literal_src1_f64
# GCN: V_FMA_F64_e64 0, killed %0, 0, %2, 0, killed %1, 0, 0, implicit $mode, implicit $exec
---
name:            test_fmamk_reg_unfoldable_literal_src1_f64
registers:
  - { id: 0, class: vreg_64_align2 }
  - { id: 1, class: vreg_64_align2 }
  - { id: 2, class: vreg_64_align2 }
  - { id: 3, class: vreg_64_align2 }
body:             |
  bb.0:

    %0 = IMPLICIT_DEF
    %1 = COPY %0
    %2 = V_MOV_B64_PSEUDO 123456, implicit $exec
    %3 = V_FMAC_F64_e32 killed %0, %2, killed %1, implicit $mode, implicit $exec

...

# GCN-LABEL: name: test_fmaak_reg_unfoldable_literal_src2_f64
# GCN: V_FMA_F64_e64 0, killed %0, 0, killed %1, 0, %2, 0, 0, implicit $mode, implicit $exec
---
name:            test_fmaak_reg_unfoldable_literal_src2_f64
registers:
  - { id: 0, class: vreg_64_align2 }
  - { id: 1, class: vreg_64_align2 }
  - { id: 2, class: vreg_64_align2 }
  - { id: 3, class: vreg_64_align2 }
body:             |
  bb.0:

    %0 = IMPLICIT_DEF
    %1 = COPY %0
    %2 = V_MOV_B64_PSEUDO 123456, implicit $exec
    %3 = V_FMAC_F64_e32 killed %0, killed %1, %2, implicit $mode, implicit $exec

...
